function test(){
    let score = 0 ;
    //填空得分
    score = output_Blank(inputObj_Blank().Blank,score);
    //单选得分
    score = output_Choice(inputObj_Choice().Choice,score);
    //多选得分
    score = output_Checkbox(inputObj_Checkbox().Checkbox,score) ;
    //判断得分
    score = output_Judge(inputObj_Judge().Judge,score);
    //简答得分
    score = output_Text(inputObj_Text().Text,score) ;

    document.getElementById('output').innerText = score + '分' ;
    return true ;
}

//模态框显示函数
$(function(){
    $('#myModal').on('show.bs.modal', function () {
        let Obj_ID = [];
        let arr = [] ;
        arr = document.getElementById('ID').getElementsByTagName('input') ;
        for(let item of arr){
              Obj_ID.push(item.value);
         }
        if(Obj_ID[0]){
            document.getElementById('klass').innerHTML = Obj_ID[0];
        }
        if(Obj_ID[1]){
            document.getElementById('stdentId').innerHTML = Obj_ID[1];
        }
        if(Obj_ID[2]){
            document.getElementById('name').innerHTML = Obj_ID[2];
        }
    })  
})
//每一个输入都是用类数组对象储存的
function inputObj_Blank(){
    let Obj_Blank = {} ;
    Obj_Blank.Blank = [] ;
    let arr = [] ;
    arr = document.getElementById('Blank').getElementsByTagName('input') ;
    for(let item of arr){
        Obj_Blank.Blank.push(item.value);
    }
    return Obj_Blank ;
}
function output_Blank(collection,score){
    let really = ['多态性','封装性','继承性']
    if(collection[0] === '统一建模语言'){
        score +=5 ;
    }
    for(let item of collection){
        if(really.indexOf(item) !== -1){//存在的话，返回的是自然数，在逻辑非下，返回true,进入if内部
            score +=5 ;
        }
    }
    return score ;
}

function inputObj_Choice(){
    let Obj_Choice = {} ;
    Obj_Choice.Choice = [] ;
    let arr = [] ;
    arr = document.getElementById('Choice').getElementsByTagName('input') ;
    for(let item of arr){
        if(item.checked){
            Obj_Choice.Choice.push(item.value);
        }
    }
    return Obj_Choice ;
}
function output_Choice(collection,score){
    let really = ['B','A'] ;
    for(let key in collection){
        if(collection[key] === really[key]){
            score += 10 ;
        }
    }
    return score ;
}

function inputObj_Checkbox(){
    let Obj_Checkbox = {} ;
    Obj_Checkbox.Checkbox = [[],[]] ;
    let arr1 = [] ;
    let arr2 = [] ;
    //多选的每一题需要分开
    arr1 = document.getElementById('Checkbox1').getElementsByTagName('input') ;
    arr2 = document.getElementById('Checkbox2').getElementsByTagName('input') ;
    for(let item of arr1){
        if(item.checked){
            Obj_Checkbox.Checkbox[0].push(item.value);
        }
    }
    for(let item of arr2){
        if(item.checked){
            Obj_Checkbox.Checkbox[1].push(item.value);
        }
    }
    return Obj_Checkbox ;
}
function output_Checkbox(collection,score){
    let really1 = ['A','B','D'] ;
    let really2 = ['A','B','C'] ;
    if(collection[0].toString() === really1.toString()){//如果全等就加10分
        score += 10 ;
    }else if(collection[0].indexOf('C') === -1){//有C不得分，部分对，一个2分
         for(let item of collection[0]){
            if(really1.indexOf(item) !== -1){
                score += 2 ;
            }
        }
    }
    if(collection[1].toString() === really2.toString()){
        score += 10 ;
    }else if(collection[0].indexOf('D') === -1){
        for(let item of collection[1]){
            if(!really2.indexOf(item)){
                score +=2 ;
            }
        }
    }
    return score ;
}

function inputObj_Judge(){
    let Obj_Judge= {} ;
    Obj_Judge.Judge = [] ;
    let arr = [] ;
    arr = document.getElementById('Judge').getElementsByTagName('input') ;
    for(let item of arr){
        if(item.checked){
            Obj_Judge.Judge.push(item.value);
        }
    }
    return Obj_Judge ;
}
function output_Judge(collection,score){
    let really = ['B','A'] ;
    for(let key in collection){
        if(collection[key] === really[key]){
            score += 10 ;
        }
    }
    return score ;
}

function inputObj_Text(){
    let Obj_Text = {} ;
    Obj_Text.Text = document.getElementById('Text').value ;
    return Obj_Text ;
}
function output_Text(collection,score){
    let str = '模型是对现实世界的简化和抽象，模型是对所研究的系统、过程、事物或概念的一种表达形式，可以是物理实体，可以是某种图形，或者是一种数学表达式';
    if(collection === str){
        score += 20 ;
    }
    return score ;
}